package com.training.java.core.collections.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.training.java.core.collections.Car;

/**
 * This demo is to observe the List type of Collections.
 * 
 * @author soumya
 * 
 */
public class CarMutableDemo {

	public static void main(String[] args) {
		Car Honda = new Car("Honda", "Accord", "1234");
		Car Toyota = new Car("Toyota", "Corrolla", "5467");
		Car Chevy = new Car("Chevy", "Volt", "4321");

		// Different cars are added to the list

		List cars = new ArrayList();

		cars.add(Honda);
		cars.add(Toyota);
		cars.add(Chevy);

		// reading the list

		Iterator ite = cars.listIterator();

		while (ite.hasNext()) {
			Car car1 = (Car) ite.next();

			System.out.println(" Car make : " + car1.getMake());
			System.out.println(" Car model : " + car1.getModel());
			System.out.println(" Car vinNumber : " + car1.getvinNumber());
			System.out.println(" ");

		}

	}

}
